package iogame.test.hall;

import com.iohao.game.action.skeleton.core.BarSkeleton;
import com.iohao.game.action.skeleton.core.BarSkeletonBuilderParamConfig;
import com.iohao.game.bolt.broker.client.AbstractBrokerClientStartup;
import com.iohao.game.bolt.broker.core.client.BrokerClient;
import com.iohao.game.bolt.broker.core.client.BrokerClientBuilder;
import iogame.test.hall.action.HallAction;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;

/**
 * Hello world!
 */
@FieldDefaults(level = AccessLevel.PRIVATE)
public class GameHallServer extends AbstractBrokerClientStartup {
    @Override
    public BarSkeleton createBarSkeleton() {
        // 业务框架构建器 配置
        var config = new BarSkeletonBuilderParamConfig()
//                // 开启广播日志
//                .setBroadcastLog(true)
//                // 异常码文档生成
//                .addErrorCode(GameErrorCode.values())
                // 扫描 action 类所在包
                .scanActionPackage(HallAction.class);

        // 业务框架构建器
        var builder = config.createBuilder();
        // 添加控制台输出插件
//        builder.addInOut(new DebugInOut());
                // 开启 jsr380 验证
        builder.getSetting().setValidator(true);
        return builder.build();
    }

    @Override
    public BrokerClientBuilder createBrokerClientBuilder() {
        BrokerClientBuilder builder = BrokerClient.newBuilder();
        builder.appName("登录逻辑服");
        return builder;
    }
}
